package com.chujian.system.sys.controller;


import com.chujian.framework.core.base.BaseController;
import com.chujian.framework.core.base.BaseService;
import com.chujian.framework.core.tsdata.Result;
import com.chujian.sys.entity.SysMenu;
import com.chujian.system.sys.service.SysMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * 菜单表控制层
 *
 * @author yj
 * @since 2021-08-03
 */
@RequestMapping("/sysMenu")
@RestController
@Slf4j
public class SysMenuController extends BaseController<SysMenu> {

    @Resource
    private SysMenuService baseService;

    @Override
    public BaseService<SysMenu> getBaseService() {
        return baseService;
    }

    @GetMapping("/getTreeMenus")
    public Result<?> getTreeMenus(
            @RequestParam(value = "menuTemplateId", required = false) Long menuTemplateId,
            @RequestParam(value = "menuName", required = false) String menuName) {
        List<SysMenu> menus = baseService.getTreeMenus(menuTemplateId, menuName);
        return okRs(menus);
    }

}
